$(document).ready(function() {	
	$.ajax({
		type: "GET",
		url: "/photo/greatDESC.do",
		dataType: "json",
		success: function(data) {
			var photo = "";
			$.each(data, function(i, n) {
				photo += "<a href='pic-details.html?title="+n["photoPicTitle"]+""
				+"&writerId="+n["photoWriterId"]+""+"&picClassId="+n["photoPicClassId"]+""
				+"&photoPicCost="+n["photoPicCost"]+""+"&picId="+n["photoPicId"]+"'>"+"<img src="+"'"
				+n["photoThumbnailPicPath"]+"'"+ "width='300px' />"+"</a>";
			});
			$('#imgShow').append(photo);
		}
	});	
	let mls = $("#popular-author");
	$.ajax({
		type: "GET",
		url: "/photo/popular-author.do",
		dataType: "json",
		success: function(data) {
			console.info(data)
			mls.empty();
			$.each(data, function(i, n) {
			 console.info(i)
				 console.info(n)
					let ml1=ml.clone().appendTo(mls);
			 		
					ml1.find(".cc-user-name").text(n.userRealName).attr("data-author", n.userName);
					// ml1.find(".cc-user-desc-content").text(j.):
					ml1.find(".user_img").attr("src", n.photoWatermarkPicPath);
					ml1.find(".cc-user-desc-content").text("获赞数:"+n.photoPicGreatCount);
					ml1.find(".cc-item-top").css({"background":"url('"+n.userImg+"')","background-size": "cover", "background-repeat": "no-repeat", "background-position": "center",});
				
			});
		}
	});
	
	exec();
});

let exec = function() {
	$("body").on("click","[data-click]", function() {
		sessionStorage.author = $(this).find("[data-author]").data("author");
		//sessionStorage.author
	});
}
// <div class="cc-img-bg" style="background-image:
// url(&quot;//pic3-nc.pocoimg.cn/image/poco/works/63/2019/0425/13/15561719293708662_64925705_W240.jpeg&quot;);"></div>

//<div class="cc-item-top">
//<img class="user_img" />
//</div>
//<img class="user_img" style="z-index=99"/>

//style="background:url('../img/_noimg.png') no-repeat
let ml = $(`
<div class="w_poco_index_photographer_module_item" data-click style="width:220px;margin:5px;" >
	<a href="user_pic.html" target="_blank">
	<div class="cc-item">
		<div class="cc-item-top"  ">
		
		</div>
		
		<div class="cc-item-bottom">
			
				<div class="cc-user-name" style="font-size:10px;overflow: visible;z-index=99" ></div>
			
			<div class="cc-user-desc">
				<p class="cc-user-desc-content"></p>
			</div>
		</div>
	</div>
	</a>
</div>`);
$.ajax({
	type: "GET",
	url: "/photo/picType.do",
	dataType: "json",
	success: function(data) {
		var photo1 = "";
		photo1 += "<a href='pic-all.html?index=0&len=9' style='font-size: 30px;padding: 20px; '>查看更多</a>";
		$('#picNav').append(photo1);
	}
});

				
			
